package main

func main() {


}
func quicksort(array []int) []int  {
	if len(array) <= 1 {
		return array
	}
	pivot := array[len(array)/2]
	left := make([]int, 0)
	middle := make([]int, 0)
	right := make([]int, 0)
	for _, num := range array{
		switch{
		case num > pivot:
			right = append(right, num)
		case num == pivot:
			middle = append(middle, num)
		case num < pivot:
			left = append(left, num)
		}
	}
	res := append(quicksort(left), middle...)
	res = append(res, quicksort(right)...)
	return res
}


